﻿<Window x:Class="ImageProperties.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Image Properties" Height="700"
        Width="1100"
        MinWidth="640">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="2*" />
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>

        <Grid x:Name="imageGrid" 
              Grid.Row="0"
              Grid.Column="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Image x:Name="mainImage"
                   Grid.Row="0"
                   Grid.Column="0"
                   Grid.RowSpan="4"
                   Grid.ColumnSpan="4"
                   Stretch="Fill"
                   Source="{Binding LocalImagePath}" />
        </Grid>
        
        <Grid Grid.Row="0"
              Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <GroupBox Grid.Row="0"
                      Grid.Column="0">
                <GroupBox.Header>
                    <TextBlock Text="Histogram" FontSize="25" />
                </GroupBox.Header>
                <TabControl Grid.Row="0"
                            Grid.Column="0"
                            TabStripPlacement="Right"
                            Height="320">                        
                    <TabItem>
                        <TabItem.Header>
                            <Grid>
                                <Border Height="75" />
                                <TextBlock Text="Red"
                                            Foreground="Red"
                                            HorizontalAlignment="Center"
                                            VerticalAlignment="Center">
                                </TextBlock>
                            </Grid>
                        </TabItem.Header>
                        <Polygon Points="{Binding RedColorHistogramPoints}"
                                    Stretch="Fill"
                                    Fill="Red" />
                    </TabItem>
                    <TabItem>
                        <TabItem.Header>
                            <Grid>
                                <Border Height="75" />
                                <TextBlock Text="Green"
                                            Foreground="Green"
                                            HorizontalAlignment="Center"
                                            VerticalAlignment="Center">
                                </TextBlock>
                            </Grid>
                        </TabItem.Header>
                        <Polygon Points="{Binding GreenColorHistogramPoints}"
                                    Stretch="Fill"
                                    Fill="Green" />
                    </TabItem>
                    <TabItem>
                        <TabItem.Header>
                            <Grid>
                                <Border Height="75" />
                                <TextBlock Text="Blue"
                                            Foreground="Blue"
                                            HorizontalAlignment="Center"
                                            VerticalAlignment="Center">
                                </TextBlock>
                            </Grid>
                        </TabItem.Header>
                        <Polygon Points="{Binding BlueColorHistogramPoints}"
                                    Stretch="Fill"
                                    Fill="Blue" />
                    </TabItem>
                        
                    <TabItem>
                        <TabItem.Header>
                            <Grid>
                                <Border Height="75" />
                                <TextBlock Text="Luminosity"
                                           Foreground="Black"
                                           HorizontalAlignment="Center"
                                           VerticalAlignment="Center">
                                </TextBlock>
                            </Grid>
                        </TabItem.Header>
                        <Polygon Stretch="Fill"
                                 Fill="Black"
                                 Points="{Binding LuminanceHistogramPoints}" />
                    </TabItem>
                </TabControl>
            </GroupBox>

            <GroupBox Grid.Row="1"
                      Grid.Column="0">
                <GroupBox.Header>
                    <TextBlock Text="Image properties"
                               FontSize="25" />
                </GroupBox.Header>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Row="0"
                               Grid.Column="0"
                               Text="Resolution: " />
                    <TextBlock x:Name="resolutionText"
                               Grid.Row="0"
                               Grid.Column="1" />
                
                    <TextBlock Grid.Row="1"
                               Grid.Column="0"
                               Text="Color depth: " />
                    <TextBlock x:Name="colorDepthText"
                               Grid.Row="1"
                               Grid.Column="1" />
                    <Grid Grid.Row="2"
                          Grid.Column="0"
                          Grid.ColumnSpan="2">
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Row="0"
                                   Grid.Column="0"
                                   Text="Energy: " />
                        <TextBlock Grid.Row="0"
                                   Grid.Column="1"
                                   Text="Red "
                                   Foreground="Red" />                        
                        <TextBlock Grid.Row="1"
                                   Grid.Column="1"
                                   Text="Green "
                                   Foreground="Green" />                        
                        <TextBlock Grid.Row="2"
                                   Grid.Column="1"
                                   Text="Blue "
                                   Foreground="Blue" />                        
                        <TextBlock Grid.Row="3"
                                   Grid.Column="1"
                                   Text="Luminosity "
                                   Foreground="Black" />                        
                    </Grid>
                    <Grid Grid.Row="2"
                          Grid.Column="1">
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <TextBlock x:Name="energyRedText"
                                   Grid.Row="0"
                                   Grid.Column="0"
                                   Foreground="Red" />
                        <TextBlock x:Name="energyGreenText"
                                   Grid.Row="1"
                                   Grid.Column="0"
                                   Foreground="Green" />
                        <TextBlock x:Name="energyBlueText"
                                   Grid.Row="2"
                                   Grid.Column="0"
                                   Foreground="Blue" />
                        <TextBlock x:Name="energyLuminosityText"
                                   Grid.Row="3"
                                   Grid.Column="0"
                                   Foreground="Black" />
                    </Grid>
                    
                    <TextBlock Text="Probable image type: "
                               Grid.Row="3"
                               Grid.Column="0" />
                    <TextBlock x:Name="probableImageTypeText"
                               Grid.Row="3"
                               Grid.Column="1"
                               Text="outdoors"/>
                </Grid>
            </GroupBox>

            <GroupBox Grid.Row="2"
                      Grid.Column="0">
                <GroupBox.Header>
                    <TextBlock Text="Settings"
                               FontSize="25" />                
                </GroupBox.Header>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <ToggleButton x:Name="rectangleOverlayVisibilityToggle"
                                  Grid.Row="0"
                                  Grid.Column="0"
                                  IsChecked="True"
                                  Click="rectangleOverlayVisibilityToggle_Click">
                        <ToggleButton.Content>
                            <StackPanel HorizontalAlignment="Stretch"
                                        VerticalAlignment="Center"
                                        Orientation="Vertical">
                                <TextBlock Text="Toggle"
                                           FontSize="20"
                                           HorizontalAlignment="Center" />
                                <TextBlock Text="Overlay"
                                           FontSize="20"
                                           HorizontalAlignment="Center" />
                            </StackPanel>
                        </ToggleButton.Content>
                    </ToggleButton>
                    <Button x:Name="loadImageButton"
                            Grid.Row="0"
                            Grid.Column="1"
                            FontSize="20"                            
                            Click="loadImageButton_Click_1">
                        <Button.Content>
                            <StackPanel HorizontalAlignment="Stretch"
                                        VerticalAlignment="Center"
                                        Orientation="Vertical">
                                <TextBlock Text="Load"
                                           FontSize="20"
                                           HorizontalAlignment="Center" />
                                <TextBlock Text="New"
                                           FontSize="20"
                                           HorizontalAlignment="Center" />
                                <TextBlock Text="Image"
                                           FontSize="20"
                                           HorizontalAlignment="Center" />
                            </StackPanel>                            
                        </Button.Content>
                    </Button>
                </Grid>
            </GroupBox>
        </Grid>

        <Grid Grid.Row="1"
              Grid.Column="0"
              Grid.ColumnSpan="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="50" />
                <ColumnDefinition Width="60" />
                <ColumnDefinition Width="60" />
                <ColumnDefinition Width="50" />
                <ColumnDefinition Width="50" />
                <ColumnDefinition Width="33" />
                <ColumnDefinition Width="50" />
                <ColumnDefinition Width="33" />
                <ColumnDefinition Width="50" />
                <ColumnDefinition Width="33" />
                <ColumnDefinition Width="70" />
                <ColumnDefinition Width="33" />
            </Grid.ColumnDefinitions>
            <TextBlock x:Name="positionLabel"
                       Grid.Column="0"
                       HorizontalAlignment="Right"
                       Text="Position: " />
            <TextBlock x:Name="positionText"
                       Grid.Column="1"
                       HorizontalAlignment="Left"/>
            <TextBlock x:Name="pixelColorLabel"
                       Grid.Column="2"
                       Text="Pixel color: "
                       HorizontalAlignment="Right"/>
            <Rectangle x:Name="pixelColorRectangle"
                       Grid.Column="3"
                       Width="Auto"
                       Height="Auto" />
            
            <TextBlock Text="Red: "
                       Grid.Column="4"
                       HorizontalAlignment="Right"
                       Foreground="Red" />
            <TextBlock x:Name="pixelColorRedText"
                       Grid.Column="5"
                       HorizontalAlignment="Left"
                       Foreground="Red" />
            <Border Width="20" />
            
            <TextBlock Text="Green: "
                       Grid.Column="6"
                       HorizontalAlignment="Right"
                       Foreground="Green" />
            <TextBlock x:Name="pixelColorGreenText"
                       Grid.Column="7"
                       HorizontalAlignment="Left"
                       Foreground="Green" />
            <Border Width="20" />
            
            <TextBlock Text="Blue: "
                       Grid.Column="8"
                       HorizontalAlignment="Right"
                       Foreground="Blue" />
            <TextBlock x:Name="pixelColorBlueText"
                       Grid.Column="9"
                       HorizontalAlignment="Left"
                       Foreground="Blue" />
            <Border Width="20" />
            
            <TextBlock Text="Luminosity: "
                       Grid.Column="10"
                       HorizontalAlignment="Right"
                       Foreground="Black" />
            <TextBlock x:Name="pixelColorLuminosityText"
                       Grid.Column="11"
                       HorizontalAlignment="Left"
                       Foreground="Black" />
        </Grid>
    </Grid>    
</Window>
